package com.hmkj.core.mapper.sysNotice;

import com.hmkj.common.baseMapper.GenericMapper;
import com.hmkj.core.po.sysNotice.SystemNotice;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 系统公告表相关Dao接口<br>
 *
 * @author lizhijie
 * @date 2018-07-04 04:07:29
 */
public interface SystemNoticeMapper extends GenericMapper<SystemNotice, Integer> {
    @Select("SELECT t.* FROM s_system_notice t WHERE 1=1 ${whereSql} ${sortSql} limit ${nowPage}, ${pageSize} ")
    List<SystemNotice> findListBySqlJoin(Map<String, Object> params);

    @Select("SELECT count(1) FROM s_system_notice t WHERE 1=1 ${whereSql}")
    long countBySqlJoin(Map<String, Object> params);

    /**
     * 前台获取公告列表
     * @param params
     * @return
     */
    @Select(" <script> SELECT COUNT(1) FROM s_system_notice t WHERE t.del_flag = 1 AND t.status = #{status} ORDER BY t.publish_time DESC </script>")
    Integer findCountForNoticeList(Map<String, Object> params);

    /**
     * 前台获取公告列表
     */
    @Select(" <script> SELECT t.* FROM s_system_notice t WHERE t.del_flag = 1 AND t.status = #{status} ORDER BY t.publish_time DESC </script>")
    List<SystemNotice> findListForNoticeList(Map<String, Object> params);


}
